/* --------------------------------------------------------
 * Copyright (c) aeky , Inc.  All rights reserved.
 * --------------------------------------------------------
 */
package com.aeky.client.common;

import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.HTML;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.IconButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;

/**
 * 
 * @author aeky
 */
public class WidgetUtils {

    /**
     * create BR.
     * 
     * @return BR HTML
     */
    public static HTML createBR() {
        return new HTML("<br/>");
    }

    /**
     * Creates the preference link.
     * 
     * @return the anchor
     */
    public static Anchor createPreferenceLink() {
        Anchor preference = new Anchor(
                "<img src='images/preference.gif' style='vertical-align: middle;padding-bottom:5px;border:0;'/> "
                        + "个人设置", true, "javascript:void(0)");
        preference.setStyleName("demo_help_style");
        return preference;
    }

    public static IconButton createPreferenceIconButton() {
        IconButton button = new IconButton("个人设置");
        button.setTitle("个人设置");
        button.setIcon("preference.gif");
        button.setAlign(Alignment.RIGHT);
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {

            }
        });
        return button;
    }

    /**
     * Open help documents.
     * 
     * @return the anchor
     */
    public static Anchor openHelpDocuments() {
        Anchor help = new Anchor(
                "<img src='images/help.gif' style='vertical-align: middle;padding-bottom:5px;border:0;'/> " + "帮助",
                true, GWTUtils.getContextUrl() + "doc/说明");
        help.setStyleName("demo_help_style");
        return help;
    }

    public static IconButton createOpenHelpDocumentsIconButton() {
        IconButton button = new IconButton("帮助");
        button.setTitle("帮助");
        button.setAlign(Alignment.RIGHT);
        button.setIcon("help.gif");
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {

            }
        });
        return button;
    }

    /**
     * Creates the logout link.
     * 
     * @return log out link
     */
    public static Anchor createLogoutLink() {
        Anchor logout = new Anchor(
                "<img src='images/logout.gif' style='vertical-align: middle;padding-bottom:5px;border:0;'/> " + "退出",
                true, "javascript:void(0)");
        logout.setStyleName("demo_help_style");
        return logout;
    }

    public static IconButton createLogoutIconButton() {
        IconButton button = new IconButton("退出");
        button.setTitle("退出");
        button.setAlign(Alignment.RIGHT);
        button.setIcon("logout.gif");
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {

            }
        });
        return button;
    }

}
